package com.jpro.module.bpm.api.task.rpc;

import com.jpro.framework.common.pojo.CommonResult;
import com.jpro.module.bpm.api.task.dto.BpmProcessInstanceRpcCreateReqDTO;
import com.jpro.module.bpm.service.task.BpmProcessInstanceService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Flowable 流程实例 Api 实现类
 *
 * @author jprocms
 */
@RestController // 提供 RESTful API 接口，给 Feign 调用

@Validated
public class BpmProcessInstanceRpcApiImpl implements BpmProcessInstanceRpcApi {

    @Resource
    private BpmProcessInstanceService processInstanceService;

    @Override
    public CommonResult<String> createProcessInstance(@RequestBody BpmProcessInstanceRpcCreateReqDTO reqDTO) {
        return CommonResult.success(processInstanceService.createProcessInstance(reqDTO.getUserId(), reqDTO));
    }
}
